package C;

import java.util.Arrays;
import java.util.Scanner;
import java.util.StringJoiner;

public class C37 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        int[] nums = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        System.out.println(Arrays.toString(nums));
        System.out.println(getResult(nums,n));
    }
    public static String getResult(int[] nums,int n) {
        int[] sums = new int[n];
        for (int i=0;i<n;i++) {
            sums[i] = nums[i]*2;
        }
        System.out.println(Arrays.toString(sums));
        StringJoiner sj = new StringJoiner(" ");
        for (int i=0;i<n;i++) {
            for (int j=0;j<n;j++) {
                if (j == i) continue;
                for (int k=0;k<n;k++) {
                    if (k == i || k == j) continue;
                    if (nums[i] == nums[j]+sums[k]) {
                        sj.add(String.valueOf(nums[i])).add(String.valueOf(nums[j])).add(String.valueOf(nums[k]));
                        return sj.toString();
                    }
                }
            }
        }

        return String.valueOf(0);
    }
}
